package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsAdminMapper;
import com.qf.pojo.DtsAdmin;
import com.qf.vo.CatVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.qf.service
 * @Description:
 * @Date 2022/6/16 15:20
 */

public class Adminserviceimpl implements Adminservice {
    @Autowired
    private DtsAdminMapper adminMapper;

    @Override
    public List<DtsAdmin> findAdminByUserName(String username) {
        //创建查询条件对象
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("username", username);
        queryWrapper.eq("deleted", false); //false对应0,  true对应1
        //查询并返回结果
        List<DtsAdmin> list = adminMapper.selectList(queryWrapper);
        System.out.println("LSit集合" + list);
        return list;
    }

    /**
     * 只查用户id和用户名
     * @return
     */
    @Override
    public List<CatVo> findIdAdnUsername() {
        List<CatVo> adminLists = adminMapper.adminAll();
        return adminLists;
    }

}
